Skip to content

Add version control command center - #3177

Open
Quicksaver wants to merge 191 commits into
pingdotgg:mainfrom
Quicksaver:split/version-control-panel-work
Open

Add version control command center#3177
Quicksaver wants to merge 191 commits into
pingdotgg:mainfrom
Quicksaver:split/version-control-panel-work

Conversation

@Quicksaver

@Quicksaver Quicksaver commented Jun 19, 2026

Copy link
Copy Markdown

PR id: 3177
PR url: #3177
PR title: Add version control command center
PR target: pingdotgg/t3code:main
PR head: Quicksaver:split/version-control-panel-work

Summary

Adds a Git-backed Version Control command center to the web right panel and a native mobile route. It is scoped to each repository cwd, works from draft or existing conversations once repository context is available, and keeps Git operations server-authoritative across browser, desktop, VS Code, mobile, and remote clients.

The panel focuses on actionable repository work rather than acting as a full Git dashboard: dirty working trees, branch sync state, stashes, remotes, sibling worktrees, likely fork branches, and open change-request bases.

What Changed

  • Added SOURCE_CONTROL.md as the behavior and validation reference for the Version Control panel.
  • Added server-side panel RPCs for snapshots, working-tree and comparison data, selected-file commit/stash/discard flows, branch and commit actions, stash actions, remote management, and provider-backed PR/MR base checks.
  • Added live VCS status updates with subscription-scoped local watchers, explicit refreshes, sibling-worktree retention, gitignore-aware suppression, and .git/ event filtering.
  • Added the web Version Control surface with Actionable and Remotes sections, file selection and diffs, searchable compare bases, branch/stash/commit details, guarded destructive actions, context menus, manual fetch controls, and a conservative five-minute automatic fetch interval.
  • Added a touch-oriented native mobile Version Control route and review-diff flow with selected-file operations, branch/stash/remote actions, detail loading, retry states, and stale-result protection.
  • Federated the web surface across connected environments: each connected environment gets an independently routed panel instance, the active environment appears first, failures remain isolated, and only the active instance updates thread metadata or opens standalone files.
  • Added cwd-scoped dirty sibling-worktree rows, file previews, snapshots, subscriptions, diffs, editor launches, and Git mutations.
  • Centralized right-panel surface actions and protected the singleton Source Control surface across grouped-project navigation, browser reconciliation, background preview mini-player transitions, teardown-order changes, and unavailable-surface fallback.
  • Added shared rich row tooltips with panel-aligned cards, trigger-scoped file anchors, and nested-action tooltip behavior that preserves only the originating parent card.
  • Added concurrency and stale-result safeguards for snapshot refreshes, queued refreshes, per-row native detail retries, retryable native focus-time fetches, detail pagination, mutations, cache-scoped environment-panel remounts, cwd changes, thread metadata sequencing, and expectedBranch server guards.
  • Scoped SourceControlPanelService to the server runtime so every WebSocket client shares snapshot state and automatic-fetch de-duplication, while retaining optional provider and text-generation integrations through canonical Effect service access.
  • Invalidated shared server and client ref caches after ref-changing commit, branch, fetch, and remote mutations settle, including failures and interruptions, while skipping cached fetches, validation-only failures, and working-tree, stash, diff, and other read-only operations.
  • Hardened branch behavior for repository default branches, slashful remotes, remote-looking local refs, local-only publishing, fork and PR/MR base branches, diverged sync, checked-out branches, branch worktree ownership, older Git worktree output, and remote checkout name collisions.
  • Isolated selected-file commits through a temporary selected-only index and applied literal-pathspec semantics across staging, unstaging, stashing, discard, intent-to-add, and commit flows so failures preserve the real index and deselected staged changes remain staged.
  • Hardened working-tree handling for renames and copies, quoted paths, mixed staged/unstaged rows, conflict-only native diffs, selected stash inputs, aggregate line stats, tracked discard failures, generated commit failures, and commit-hook diagnostics, including destination-only copy diff requests on web and mobile.
  • Preserved bounded structured causes through panel RPC errors and provider adapters, including self-hosted GitLab repository lookup, Azure DevOps remote-derived organization routing and stable API usage, and GitHub/GitLab/Azure DevOps/Bitbucket commit-avatar support.
  • Kept panel and provider wrapper messages structural rather than deriving them from cause.message, while retaining the bounded transport-safe cause projection required to prevent credential-bearing CLI failures from crossing the RPC boundary.
  • Extended shared RPC, IPC, Git, settings, client-runtime, and VCS contracts for the panel protocol.
  • Added desktop and web context-menu separator support and protected option-shaped merge/rebase refs with an explicit separator.
  • Added focused server, provider, VCS, web, desktop, shared-contract, client-runtime, and native model/request coverage for the behavior above.

Why

T3 Code needs a compact place to answer “what repository work needs attention now?” without forcing users into a full external Git UI. This change keeps the surface decision-oriented: commit or stash selected changes, inspect branch sync state, publish or sync branches, review stashes, and notice when a PR/MR base has moved.

Keeping Git execution and reconciliation on the server gives every client the same behavior, while local watchers and bounded periodic fetching keep the panel current without a high-frequency polling loop.

Validation

  • Focused server coverage passed for SourceControlPanelService, panel parsers, Git/VCS behavior, watcher lifetimes, provider discovery and diagnostics, and Azure DevOps and self-hosted GitLab paths.
  • Focused server route-layer coverage passed with the process-scoped panel service supplied through the shared runtime/test seam.
  • Focused panel/provider error coverage passed for structural wrapper messages, caller-supplied provider detail precedence, bounded cause diagnostics, and credential-bearing URL sanitization.
  • Focused web coverage passed for panel logic/state, thread source-control routing, federated environments, cache-identity context switches, rich tooltips, right-panel behavior, queued refreshes, mutation-owned error preservation, mutation reconciliation, and Source Control preservation across preview mini-player and browser-surface lifecycle transitions.
  • Focused shared, desktop, and native coverage passed for contracts, client-runtime VCS actions, Electron context menus, and mobile Version Control model/request behavior, including per-row detail sequencing, failed automatic-fetch retries, and copy-specific diff path selection.
  • Focused server and client-runtime coverage passed for shared ref-cache invalidation across successful, failed, interrupted, cached, and validation-only panel mutation paths.
  • Targeted formatting, lint, mobile native static checks, and diff checks passed. Optional Swift/Kotlin linters were unavailable. The latest server typecheck reached the changed runtime composition cleanly but remains blocked by the existing HttpResponseCompression.ts Response.body incompatibility; later package-wide web and mobile typechecks were likewise blocked by unrelated upstream and linked-package errors outside the changed Version Control files.
  • Isolated browser passes on server 13782 and web 5742 authenticated and rendered live Actionable and Remotes data from disposable Git repositories. They also exercised project-context switching without cross-cache state leakage, selected-file commit success and failure, post-hook reconciliation, literal-path discard/stash isolation, live mutation refresh behavior, and a destination-only copied-file diff.
  • Isolated iOS development-client passes connected to server 13782 and this worktree’s Metro bundle, rendered the live Version Control panel from disposable Git repositories, exercised collapse/re-expand detail loading, exercised a conflicting branch checkout, and rendered a destination-only copied-file diff. The representative simulator streams reached live rendered frames through serve-sim.

Proof

Screenshot 2026-06-16 at 19 26 39 share_6957608233718139520

Note

High Risk
Large cross-stack Git mutation surface (server-authoritative refs, index, fetch defaults, and thread metadata) with broad behavioral and concurrency edge cases; incorrect reconciliation or stale snapshots could mislead users or leave repo state inconsistent with the UI.

Overview
Introduces a Git-backed Version Control panel on the web right panel (source-control singleton) and a native Version Control full-screen route on mobile, both driven by a shared server SourceControlPanelService and a large set of new vcs.panel.* WebSocket RPCs (snapshots, working-tree commit/stash/discard, branches, stashes, remotes, diffs, compare).

The web surface federates one panel per connected environment in a logical repo group (active first), keeps Git work cwd- and environment-scoped, and routes thread branch metadata updates with expectedBranch guards and per-thread error state. Mobile adds Actionable / Remotes UI, selected-file flows, publish-remote prompting, sequenced snapshot/detail requests, and a Version Control diff overlay using the native Review renderer.

Freshness and caching: VCS watchers ignore internal .git/ noise, retain sibling worktrees, and promote working-tree refreshes to full snapshots when branch/remote state may be stale; ref-changing mutations invalidate shared ref caches on settle (server + client). Default automatic remote fetch moves to a 5-minute custom profile (explicit presets still use 15s / 30s / disabled).

Smaller glue: Git menus link to Version Control; Electron context menus honor explicit separators and destructive grouping; mobile git checkout sheets only pop on success; atom query runners support forceRefresh for panel reads.

Reviewed by Cursor Bugbot for commit b054cde. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Version Control panel with branch, working tree, and diff management to web and mobile

  • Introduces a full-featured Version Control panel on web (SourceControlPanel.tsx) and mobile (VersionControlRouteScreen.tsx) for managing staged/unstaged files, branches, stashes, remotes, and diffs per environment/thread
  • Adds a new server-side SourceControlPanelService wired into the server and WebSocket layer, exposing ~25 RPC methods for snapshot, file operations, branch operations, stash, fetch, and compare
  • Extends all four source control providers (GitHub, GitLab, Bitbucket, Azure DevOps) with getCommitAvatarUrl and remote-context-aware PR listing; adds a per-provider showCommitAuthorAvatar setting defaulting to false
  • Adds forceRefresh support to executeAtomQuery and useAtomQueryRunner on both web and mobile so VCS panel queries bypass SWR cache after mutations
  • Changes the default automaticGitFetchInterval from 30 seconds to 5 minutes in settings.ts
  • Risk: the fetch interval default change affects all existing installations that have not explicitly configured the interval

Macroscope summarized b054cde.

- Query open change requests across supported remotes
- Surface actionable branch rows only when local branch is behind the MR/PR base
- Pass remote repository context to GitHub, GitLab, and Azure DevOps CLIs
…ol-panel-work

# Conflicts:
#	apps/web/src/components/ChatView.tsx
#	apps/web/src/environmentApi.ts
#	apps/web/src/environments/runtime/service.threadSubscriptions.test.ts
#	packages/client-runtime/src/wsRpcClient.ts
- Extract shared source control panel state and API wiring
- Move VS Code project scope and subagent parent resolution into runtime helpers
- Add tests for presentation state and subagent control resolution
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: be14cdd6-af7e-4404-a0f0-0fe87b7a665f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Jun 19, 2026
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx Outdated
Comment thread apps/web/src/components/source-control/SourceControlPanel.tsx Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

- Treat same-name remotes as publish/pull upstreams
- Split sync-state logic into shared web module
- Cover publish target behavior with tests and docs
- Add `forceRefresh` support to query runners and runtime execution
- Refresh cached SWR atoms before resolving so panel data stays current
- Cover first-run and cached-refresh behavior with runtime tests
- Move sync refresh feedback into a compact spinner icon
- Keep the banner for non-refresh sync messages
- Sum merged working-tree row stats across both sides

- Keep default compare ref on the repository default branch

- Restrict diverged merge sync to the checked-out branch

- Surface tracked discard failures and rename sources

- Move shared panel logic into the logic module
- Infer rename status for numstat fallback entries
- Align diverged merge sync guard and disabled state
- Clarify aggregate working-tree stats and date buckets
…ol-panel-work

# Conflicts:
#	apps/desktop/src/electron/ElectronMenu.ts
#	apps/server/src/sourceControl/AzureDevOpsCli.ts
#	apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.ts
#	apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
#	apps/server/src/sourceControl/GitHubCli.ts
#	apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts
#	apps/server/src/sourceControl/GitHubSourceControlProvider.ts
#	apps/server/src/sourceControl/GitLabCli.ts
#	apps/server/src/sourceControl/SourceControlProvider.ts
#	apps/server/src/vcs/VcsStatusBroadcaster.ts
#	apps/server/src/ws.ts
#	apps/web/src/components/ChatView.tsx
#	apps/web/src/components/Sidebar.logic.ts
#	apps/web/src/hooks/useHandleNewThread.ts
Comment thread apps/vscode-extension/scripts/package-dependencies.mjs Outdated
Comment thread apps/vscode-extension/src/extension.ts Outdated
Comment thread apps/vscode-extension/scripts/package.mjs Outdated
Comment thread apps/web/src/session-logic.ts Outdated
Comment thread apps/server/src/vscodeWorkspaceBootstrap/http.ts Outdated
Comment thread apps/web/src/session-logic.ts Outdated
Comment thread apps/vscode-extension/src/backendManager.ts Outdated
Comment thread apps/vscode-extension/src/webview.ts Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect Service Conventions: one finding in DesktopBackendManager.ts. See inline comment.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/desktop/src/backend/DesktopBackendManager.ts Outdated
T3 Verification added 7 commits July 28, 2026 23:37
T3 Verification added 2 commits July 29, 2026 10:30
- Sequence mobile detail loads per expanded row
- Keep web mutation failures separate from refresh errors
- Cover both stale-error paths with focused tests
Comment thread apps/mobile/src/features/version-control/VersionControlRouteScreen.tsx Outdated
T3 Verification added 2 commits July 29, 2026 12:19
- Key environment panels by their complete cache identity
- Remount in-flight refresh state when repository context changes
- Cover thread, cwd, and worktree identity changes
- Release the per-cwd automatic-fetch latch after failed or interrupted attempts
- Preserve successful and in-flight fetch deduplication
- Cover failure retries and duplicate suppression with focused tests

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the Effect service changes in this PR (new SourceControlPanelService and its helper modules, provider/CLI service extensions, GitVcsDriver.invalidateRefs, VcsLocalWatch, contracts/settings). The earlier FooShape aliases in GitHubCli/GitLabCli/AzureDevOpsCli/GitVcsDriver/SourceControlPanelService are gone and the panel service now declares its interface inline — thanks. Three service-convention issues remain, all in the new panel service wiring.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/ws.ts Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts Outdated
Construct the panel service once in the server runtime so WebSocket clients reuse snapshot and fetch caches. Use canonical optional Effect service access and keep the server route test seam explicit.

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the Effect service changes in this PR (new SourceControlPanelService + Readers/Actions split, SourceControlProvider error factory, provider CLI/API additions, VcsLocalWatch/VcsStatusBroadcaster, contracts/client-runtime wiring).

Prior findings look addressed: the panel service now declares its interface inline in Context.Service, keeps imports at the top, acquires optional dependencies with Effect.serviceOption, exposes make/layer, is registered in server.ts, and ws.ts acquires it from the environment instead of constructing it per session. The FooShape aliases are gone and tests use Foo["Service"].

Two remaining findings, both about error wrapping: the new wrappers replace the immediate underlying failure with a flattened, stringified copy instead of preserving it as cause, and derive detail (and therefore the wrapper message) from cause.message.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/sourceControl/SourceControlProvider.ts
Comment thread apps/server/src/sourceControl/SourceControlPanelService.ts
T3 Verification added 11 commits July 29, 2026 13:38
Stop deriving provider and panel wrapper details from unknown cause messages. Preserve the existing bounded transport-safe cause projection so credential-bearing CLI failures cannot cross the RPC boundary.
…ol-panel-work

# Conflicts:
#	apps/server/src/vcs/VcsStatusBroadcaster.test.ts
#	apps/server/src/vcs/VcsStatusBroadcaster.ts
#	apps/server/src/ws.ts
#	apps/web/src/components/ChatView.tsx
#	packages/contracts/src/settings.ts
#	packages/shared/src/serverSettings.test.ts
- Compare legacy values against the customized flat default
- Cover migration of persisted thirty-second fetch settings
- Pin the upstream empty-object background activity default
- Prove balanced profiles override the branch legacy flat default
- Disable color, external diff helpers, and text conversion
- Cover ref-backed and no-range comparison patch paths
- Pin patch prefixes and context against Git configuration
- Avoid minimal diff work on previously unbounded paths
- Cover hardened arguments in focused server tests

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 10 total unresolved issues (including 9 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 03517b2. Configure here.

- Send rename source paths only for renamed rows
- Cover web and mobile copy diff path selection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant